package com.njaccp;


import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.Date;

public class App
{
    public static void main ( String[] args )throws Exception {
        Test t = new Test(1,"dy",new Date());
        ObjectMapper om = new ObjectMapper();
//        String str = om.writeValueAsString(t);
//        Test tt = om.readValue(str,Test.class);

        String str = JSON.toJSONString(t);
        Test tt = JSON.parseObject(str,Test.class);
//        String str =  Reader.toJson(t) ;
//       Test tt= Reader.parseObject(str,Test.class);

        System.out.println(str);
        System.out.println(tt.getTname()+"："+tt.getTdate());
    }
}
